import uiautomator2 as u2
import time

# 连接设备
device = u2.connect()

print(device.info)

print(device.device_info)

# 安装app
url = "https://ksupdate.enjoymi.com/packages/69555_800179_huandongall2_0.14.90.0_282_1909_64_com_v1_v2.apk"

# device.app_install(url)

# 获取并输出已安装应用的包名列表
app_list = device.app_list()
print("已安装的应用包名列表：")
# for app in app_list:
#     print(app)

app = "com.baidu.tieba"
## 启动应用
device.app_start(app)
## 休息五秒钟
time.sleep(5)
## 关闭app
# device.app_stop(app)
## 输出正在运行的app
print(f"正在运行的app： {device.app_current()} ")

## 打印app信息
print(device.app_info(app))

## 清理app数据
# device.app_clear(app)
